
#ifndef COMMON_PLATFORM_H
#define COMMON_PLATFORM_H

/******************************************************************************/
/*----------------------------------Includes----------------------------------*/
/******************************************************************************/
#include "hb_Memory.h"
#include "SpiTpMaster.h"
#include "main.h"
/******************************************************************************/
/*-----------------------------------Macros-----------------------------------*/
/******************************************************************************/
//typedef unsigned char boolean;     // TODO: adapt to customer
//typedef signed char sint8;         // TODO: adapt to customer
//typedef unsigned char uint8;       // TODO: adapt to customer
//typedef signed short sint16;       // TODO: adapt to customer
//typedef unsigned short uint16;     // TODO: adapt to customer
//typedef signed long sint32;        // TODO: adapt to customer
//typedef unsigned long uint32;      // TODO: adapt to customer
//typedef unsigned long long uint64; // TODO: adapt to customer
//typedef signed long long sint64;   // TODO: adapt to customer

//#define FALSE 0u                   // TODO: adapt to customer
//#define TRUE 1u                    // TODO: adapt to customer

#define SPITP_MASTER_ENTER() __disable_irq() // TODO: adapt to customer
#define SPITP_MASTER_EXIT() __enable_irq()   // TODO: adapt to customer

/******************************************************************************/
/*--------------------------------Enumerations--------------------------------*/
/******************************************************************************/
typedef enum {
    SpiIf_Status_ok,
    SpiIf_Status_busy,
    SpiIf_Status_unknown
} SpiIf_Status;
/******************************************************************************/
/*-----------------------------Data Structures--------------------------------*/
/******************************************************************************/

/******************************************************************************/
/*------------------------------Global variables------------------------------*/
/******************************************************************************/

/******************************************************************************/
/*-------------------------Function Prototypes--------------------------------*/
/******************************************************************************/
extern SpiIf_Status hb_SpiMaster_getStatus(void);
extern SpiIf_Status hb_SpiMaster_exchange(const void *src, void *dest,
                                          uint32 count);

extern void hb_Memory_Init(void);

extern void *hb_memset(void *s, int c, uint32 n);
extern void *hb_memcpy(void *dest, const void *src, uint32 n);
extern int hb_memcmp(const void *cs, const void *ct, uint32 count);
extern int hb_strcmp(const char *cs, const char *ct);
extern uint32 hb_strlen(const char *s);

extern void SpiTp_masterFiniNotification(void); // TODO: adapt to customer
extern void SpiTp_masterErrNotification(void);  // TODO: adapt to customer
extern void SpiTp_masterFrameExchange(void);    // TODO: adapt to customer
extern void hb_masterPrepareNotify(void);       // TODO: adapt to customer

#endif // COMMON_PLATFORM_H
